package co.edu.usbcali.banco.modelo.dto;

import co.edu.usbcali.banco.modelo.Pais;
import co.edu.usbcali.banco.presentation.backEndBeans.PaisView;

import java.io.Serializable;

import java.util.Date;

import javax.faces.event.ActionEvent;


/**
*
*
* @author Zathura Code Generator http://code.google.com/p/zathura
*
*/
public class PaisDTO implements Serializable {
    private static final long serialVersionUID = 1L;
    private String nombrepais;
    private String codigopais;
    private boolean rowSelected = false;
    private PaisView paisView;
    private Pais pais;

    public Pais getPais() {
        return pais;
    }

    public String listener_update(ActionEvent e) {
        try {
            paisView.action_modifyWitDTO(((codigopais == null) ||
                codigopais.equals("")) ? null : new String(codigopais),
                ((nombrepais == null) || nombrepais.equals("")) ? null
                                                                : new String(
                    nombrepais));
            rowSelected = !rowSelected;
        } catch (Exception ex) {
            return "";
        }

        return "";
    }

    public void listener_cancel(ActionEvent e) {
        codigopais = pais.getCodigopais().toString();
        nombrepais = (pais.getNombrepais() != null)
            ? pais.getNombrepais().toString() : null;
        rowSelected = !rowSelected;
    }

    /**
    * <p>Bound to commandLink actionListener in the ui that renders/unrenders
        * the Customer details for editing.</p>
        */
    public void toggleSelected(ActionEvent e) {
        codigopais = pais.getCodigopais().toString();
        nombrepais = (pais.getNombrepais() != null)
            ? pais.getNombrepais().toString() : null;
        rowSelected = !rowSelected;
    }

    public void setPais(Pais pais) {
        this.pais = pais;
    }

    public PaisView getPaisView() {
        return paisView;
    }

    public void setPaisView(PaisView paisView) {
        this.paisView = paisView;
    }

    public String getNombrepais() {
        return nombrepais;
    }

    public void setNombrepais(String nombrepais) {
        this.nombrepais = nombrepais;
    }

    public String getCodigopais() {
        return codigopais;
    }

    public void setCodigopais(String codigopais) {
        this.codigopais = codigopais;
    }

    public boolean isRowSelected() {
        return rowSelected;
    }

    public void setRowSelected(boolean rowSelected) {
        this.rowSelected = rowSelected;
    }
}
